#! /bin/sh /usr/share/dpatch/dpatch-run
## 21-fix_config-parsing.dpatch by Sven Mueller <debian@incase.de>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Fix parsing of master.conf

@DPATCH@
--- cyrus-imapd-2.4.orig/master/masterconf.c
+++ cyrus-imapd-2.4/master/masterconf.c
@@ -152,8 +152,13 @@ int masterconf_getint(struct entry *e,
     const char *val = masterconf_getstring(e, key, NULL);
 
     if (!val) return def;
-    if (!Uisdigit(*val) && 
-	(*val != '-' || !Uisdigit(val[1]))) return def;
+    if (!Uisdigit(*val) &&
+	(*val != '-' || !Uisdigit(val[1]))) {
+	    syslog(LOG_DEBUG,
+		"value '%s' for '%s' does not look like a number.",
+		val, key);
+	    return def;
+    }
     return atoi(val);
 }
 
@@ -171,6 +176,10 @@ int masterconf_getswitch(struct entry *e
 	     (val[0] == 'o' && val[1] == 'n') || val[0] == 't') {
 	return 1;
     }
+
+    syslog(LOG_DEBUG, "cannot interpret value '%s' for key '%s'. use y/n.",
+	   val, key);
+
     return def;
 }
 
